package com.example.teamwork.informationGet;

import lombok.Data;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;



@Data
public class PermissionNodeVO {

    private Long permissionId;
    private Long parentId;
    private String permissionName;
    private String operateName;
    private String permissionUrl;
    private String permissionIcon;
    private Integer permissionType;
    private Integer permissionStatus;
    private Long permissionOrder;
    private Date createTime;
    private Date modifiedTime;
    private Integer open;
    private boolean disabled;

    private List<PermissionNodeVO> children=new ArrayList<>();

    /*
     * 排序,根据order排序
     */
    public static Comparator<PermissionNodeVO> order(){
        Comparator<PermissionNodeVO> comparator = (o1, o2) -> {
            if(o1.getPermissionOrder() != o2.getPermissionOrder()){
                return (int) (o1.getPermissionOrder() - o2.getPermissionOrder());
            }
            return 0;
        };
        return comparator;
    }

}
